'use strict';
const db = uniCloud.database()
const coll = db.collection('user')
const coll2 = db.collection('guanzhong')
exports.main = async (event, context) => {
	if (event.flag == 'flag') {
		//更新选手的
		let res = await coll.where({
			_id: event.id
		}).update({
			zongfen: event.zongfen,
			shijian: event.shijian,
			tiNum: event.tiNum
		})
		return res
	} else {
		//更新观众的
		let res = await coll2.where({
			_id: event.id
		}).update({
			zongfen: event.zongfen,
			shijian: event.shijian,
			tiNum: event.tiNum
		})
		return res
	}
};
